﻿@{
    ViewBag.Title = "MenuAdd";
    Layout = Request.IsAjaxRequest() ? null : "~/Views/Shared/_AdminLayout.cshtml";
}
@model ZRT.RHPX.Entity.SysMenu

@section HeadScript {
    <script type="text/javascript">
        $(function () {

            SetCss();
            SetValidate();

            $('#ParentMenu').combotree({
                url: '@Url.Action("GetMenuTreeData")',
                required: true,
                panelHeight: 170
            });

            //保存事件
            $("#btnSave").click(function () {
                $("form").form("submit");
            });

            //form提交, 【选取所有action以 "MenuAdd" 结尾的form】
            $("form[action$='MenuAdd']").submit(function () {
                $.ajax({
                    url: $(this).attr("action"),
                    data: $(this).serialize(),
                    type: "post",
                    async: true,
                    dataType: "text",
                    success: function (data) {
                        if (data == "OK") {
                            alert("保存成功");
                            setTimeout(function () {
                                art.dialog.close();
                            }, 0)
                        } else {
                            alert('保存失败！');
                        }
                    }
                });
                return false;
            });

            //关闭
            $("#btnClose").click(function () {
                art.dialog.close();
                return false;
            });
        });

        function SetCss() {
            $("input[type='text']").addClass("txt03");
            $("select").addClass("txt03");
        }

        function SetValidate() {
            $('#MenuName').validatebox({
                required: true
            });
            $('#SeqNum').numberbox({
                required: true
            });

        }
    </script>
}
@using (Html.BeginForm("MenuAdd", "Admin"))
{
    <div class="panel" style="width: 460px;">
        <div class="panel-body panel-body-noheader panel-body-noborder dialog-content" style="padding: 3px; width: 450px; height: auto;" title="">
            <table width="100%" border="0" align="center" cellspacing="0" cellpadding="5" class="grid2">
                <tbody>
                    <tr>
                        <td align="right">名称：</td>
                        <td>
                            @Html.TextBoxFor(model => model.MenuName)
                        </td>
                    </tr>
                    <tr>
                        <td align="right">上级菜单：</td>
                        <td>
                            <input id="ParentMenu" name="ParentMenu" class="easyui-combotree" type="text" style = "width:200px; height: 23px;" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">链接地址：</td>
                        <td>@Html.TextBoxFor(model => model.NavigateUrl)</td>
                        
                    </tr>
                    <tr>
                        <td align="right">排序：</td>
                        <td>@Html.TextBoxFor(model => model.SeqNum)</td>
                    </tr>
                    <tr>
                        <td align="right">是否启用：</td>
                        <td>@Html.CheckBoxFor(model => model.IsEnable)</td>
                    </tr>
                    <tr>
                        <td align="right">图标：</td>
                        <td>@Html.TextBoxFor(model => model.IconCss)</td>
                    </tr>
                    <tr>
                        <td align="right">描述信息：</td>
                        <td>@Html.TextBoxFor(model => model.MenuDesc, new { style = "width:90%;" })</td>
                    </tr>
                </tbody>
            </table>
            <div class="dialog-button" style="text-align: right;">
                <a id="btnSave" href="javascript:void(0)" class="easyui-linkbutton">保存</a>
                <a id="btnClose" href="javascript:void(0)" class="easyui-linkbutton">关闭</a>
            </div>
        </div>
    </div>
}

